<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>宠物信息查询系统</title>

  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet"
        href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
   <link rel="stylesheet" href="static/index/css/all.min.css">
  <!-- Ekko Lightbox -->
  <link rel="stylesheet" href="static/index/css/ekko-lightbox.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="static/index/css/index.css">
  <link rel="stylesheet" href="static/index/css/adminlte.min.css">
    <link rel="stylesheet" href="static/index/css/index.css">
	  <link rel="stylesheet" href="static/index/css/query01.css">
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
  <!-- Navbar -->
  <nav class="main-header navbar navbar-expand navbar-white navbar-light">
    <!-- Left navbar links -->
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
      </li>
      <li class="nav-item d-none d-sm-inline-block">
        {% if request.args.get('name') == None %}
        <a href="login?page=querypagemsg" class="nav-link">登录
        </a>
        {% else %}
        <a href="#" id="userlogout">退出</a>
        <script>
        			  var userlogout = document.getElementById('userlogout');
        			  userlogout.onclick = function(){
        				 var flag=confirm('您确定退出吗?')
        				 if(flag == true){ location.href='/userlogout'}
        				 
        			  }
        </script>
        {% endif %}
        </a>
      </li>
    </ul>
	&nbsp;&nbsp;&nbsp;
{% include 'speak_template.html' %}
    <!-- Right navbar links -->
    <ul class="navbar-nav ml-auto">
      <!-- Navbar Search -->
      <li class="nav-item">
        <a class="nav-link" data-widget="navbar-search" href="#" role="button">
          <i class="fas fa-search"></i>
        </a>
      </li>

      <!-- Messages Dropdown Menu -->
      <li class="nav-item dropdown">
        <a class="nav-link" data-toggle="dropdown" href="#">
          <i class="far fa-comments"></i>
          <span class="badge badge-danger navbar-badge"></span>
        </a>
      </li>
      <!-- Notifications Dropdown Menu -->
      <li class="nav-item dropdown">
        <a class="nav-link" data-toggle="dropdown" href="#">
          <i class="far fa-bell"></i>
          <span class="badge badge-warning navbar-badge"></span>
        </a>
      </li>
      <li class="nav-item">
        <a class="nav-link" data-widget="fullscreen" href="#" role="button">
          <i class="fas fa-expand-arrows-alt"></i>
        </a>
      </li>
      <li class="nav-item">
        <a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#" role="button">
          <i class="fas fa-th-large"></i>
        </a>
      </li>
    </ul>
  </nav>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->
  <aside class="main-sidebar index-gradient elevation-4">
    <!-- Brand Logo -->
    <a href="/?name={{name}}" class="brand-link">
      <img src="static/icon_img/tubiao.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3"
           style="opacity: .8">
      <span class="brand-text font-weight-light">宠物智能识别系统</span>
    </a>

    <!-- Sidebar -->
    <div class="sidebar">
      <!-- Sidebar user panel (optional) -->
      <div class="user-panel mt-3 pb-3 mb-3 d-flex">
   
        {% if name== None %}
        <div class="image">
          <img src="static/icon_img/default-150x150.png" class="img-circle elevation-2" alt="User Image">
        </div>
        <div class="info">
          <a href="login" class="d-block">未登录</a>
        </div>
        {% endif %}
        {% if name!= None %}
        <div class="image">
        <!--  <img src="../dist/img/{{name}}.jpg" class="img-circle elevation-2" alt="User Image"> -->
		    <img src="http://127.0.0.1:5001/showprofileimg={{name}}" class="img-circle elevation-2" alt="User Image">
        </div>
        <div class="info">
          <a href="userCenter?name={{name}}" class="d-block">{{name}}</a>
        </div>
        {% endif %}
      </div>


      <!-- Sidebar Menu -->
      <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
          <!-- Add icons to the links using the .nav-icon class
               with font-awesome or any other icon font library -->
          <li class="nav-header">基础服务</li>
          <li class="nav-item">
            <a href="querypagemsg?name={{name}}" class="nav-link">
              <i class="nav-icon fas fa-search"></i>
              <p class="index-font">
                宠物信息查询
              </p>
            </a>
          </li>
          <li class="nav-item">
            <a href="identify?name={{name}}" class="nav-link">
              <i class="nav-icon far fa-image"></i>
              <p class="index-font">
                宠物图片识别
              </p>
            </a>
          </li>
          <li class="nav-item">
            <a href="user_com?name={{name}}" class="nav-link">
              <i class="nav-icon fas fa-columns"></i>
              <p class="index-font">
                圈友交流
              </p>
            </a>
          </li>
        </ul>
      </nav>
      <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1>宠物图片识别</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="/?name={{name}}">主页</a></li>
              <li class="breadcrumb-item active">宠物图片识别</li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>
    <section class="content">
      <div class="col-md-12">
        <div class="card card-primary">
          <div class="card-header">
          </div>
          <form method="post" enctype="multipart/form-data" id="file_upload">
            <div class="card-body">
              <div class="row">
                <div class="col-md-8">
                  <div class="form-group">
                    <label for="exampleInputFile">上传图片</label>

                    <div class="input-group">
                      <div class="custom-file">
                        <input id="exampleInputFile" name="input" type="file" onchange="showImg(this)" multiple/>
                        <label class="custom-file-label" for="exampleInputFile">支持jpg,png,jpeg等格式的图片文件</label>
                      </div>
					     <button type="submit" class="btn btn-primary ">提交</button>
						           <button type="submit" class="btn btn-outline-dark ">清空识别
                    </div>
                  </div>
                </div>
                <div class="col-md-4">
                  <div class="row">
                    <div class="col-md-3">
                
                    </div>
                      <div class="col-md-5">
                <!-- 没有东西 -->
                      </div>
                    <div class="col-md-4">
             <!--   没有东西 -->
                    </div>
                  </div>
                </div>
              </div>
              <div id="imgContainer" style="margin-top: 10px;"></div>
            </div>
            <!-- /.card-body -->
          </form>
        </div>
      </div>
      <div class="container-fluid">
        <div class="row">
          <div class="col-md-12">
			  {% if  plist != [] %}
            {% for pel in plist %}
            <div class="card card-primary card-outline">
              <div class="card-header">
				    {%for p in pel %}
                <label>识别结果</label>
              </div>
              <div class="card-body">
                <div class="row">
                  <div class="col-12 col-lg-3" style="margin-left: 50px">
                    <img src="displayimg{{p.pid}}" class="img-fluid" alt="未上传图片">
                  </div>
                  <div class="col-12 col-lg-8">
					
                    <div class="form-group">
						<table style="width: 80%;">
							<tr>
								<td><b>宠物名:</b>{{p.pname}}</td>
								<td ><b>别名:</b>{{p.oname}}</td>
							</tr>
							<tr>
								<td ><b>类别:</b>{{p.pclass}}</td>
								<td><b>来源地：</b>{{p.address}}</td>
							</tr>
							<tr>
								<td ><b>功能:</b>{{p.ability}}</td>
								<td><b>颜值：</b>{{p.bueaty}}<label>分</label></td>
							</tr>
							<tr>
								<td ><b>粘人程度:</b>{{p.pet_clingy}}<label>分</label></td>
								<td><b>友好程度：</b>{{p.pet_kind}}<label>分</label></td>
							</tr>
							<tr>
								<td ><b>智商:</b>{{p.pet_smart}}<label>分</label></td>
								<td><b>忠诚度：</b>{{p.pet_honest}}<label>分</label></td>
							</tr>		
						</table>    
						</div>
						 <div class="form-group">
			 <style>
			 
			 	 	.page{{p.pid}}{
			 	 			width: 600px;
			 	 		}
			 	 		.first{{p.pid}}{
			 	 			
			 	 			border-bottom: orangered 4px solid;
			 	 			
			 	 		}
			 	 		.second{{p.pid}}{
			 	 			border-bottom: none;
			 	 			
			 	 		}
			 	 		.third{{p.pid}}{
			 	 			border-bottom: none;
			 	 		}
			
			 </style>
	<span class="first{{p.pid}} queryfont1{{p.pid}}" id='ltitle1{{p.pid}}'>宠物介绍</span>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<span class="second{{p.pid}} queryfont1{{p.pid}}" id='ltitle2{{p.pid}}'>历史</span>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<span class="third{{p.pid}} queryfont1{{p.pid}}" id='ltitle3{{p.pid}}'>适合人群</span>
	<p class="ph">
		<ul style="font-size: 18px;display: block;" class="page{{p.pid}}" id="page01{{p.pid}}">
				
		<p>{{p.pmsg}}</p>
				</ul>
	<ul style="font-size: 18px;display:none" class="page{{p.pid}}" id="page02{{p.pid}}">
<p>{{p.pet_his}}</p>		
	</ul>
	<ul style="font-size: 18px;display: none;" class="page{{p.pid}}" id="page03{{p.pid}}">
<p> {{p.pet_fit}}</p>	
	</ul>						 
	<script>
	/* 这里的span换成 queryfont1*/
			let lis{{p.pid}}=document.querySelectorAll('.queryfont1{{p.pid}}');
					let page01{{p.pid}}=document.getElementById('page01{{p.pid}}');
					let page02{{p.pid}}=document.getElementById('page02{{p.pid}}');
					let page03{{p.pid}}=document.getElementById('page03{{p.pid}}');
					let ltitle1{{p.pid}}=document.getElementById('ltitle1{{p.pid}}');
					let ltitle2{{p.pid}}=document.getElementById('ltitle2{{p.pid}}');
					let ltitle3{{p.pid}}=document.getElementById('ltitle3{{p.pid}}');
					//console.log(lis{{p.pid}});
					for(let i=0;i<lis{{p.pid}}.length;i++){
						lis{{p.pid}}[i].onclick=function(event){
							if( event.target.classList.contains('first{{p.pid}}')){
								changePage{{p.pid}}()
								page01{{p.pid}}.style.display='block'
								ltitle1{{p.pid}}.style.borderBottom='orangered 4px solid'
								ltitle2{{p.pid}}.style.borderBottom='none'
								ltitle3{{p.pid}}.style.borderBottom='none'
							}else if( event.target.classList.contains('second{{p.pid}}')){
								changePage{{p.pid}}()
								page02{{p.pid}}.style.display='block'
								ltitle2{{p.pid}}.style.borderBottom='orangered 4px solid'
								ltitle1{{p.pid}}.style.borderBottom='none'
								ltitle3{{p.pid}}.style.borderBottom='none'
							}else{
								changePage{{p.pid}}()
								page03{{p.pid}}.style.display='block'
								ltitle3{{p.pid}}.style.borderBottom='orangered 4px solid'
								ltitle1{{p.pid}}.style.borderBottom='none'
								ltitle2{{p.pid}}.style.borderBottom='none'}}}
					function changePage{{p.pid}}(){
						document.querySelectorAll('.page{{p.pid}}').forEach(el=>{
						el.style.display='none'})}	
	</script>						 
							 
							 
							 
							 </div>
                  </div>
                </div>
              </div>
            </div>
			{% endfor%}
            {% endfor %}
			{% endif %}
			
			{% if plist == [] %}
			     <label>识别结果为空,可能本网站没有相关信息或者传入的图片有误</label>
			{% elif notanimal == '非动物' %}
			     <label>识别结果为非动物类型，请传入动物图片</label>
			{% endif %}
          </div>
        </div>
      </div>
    </section>
  </div>
  <!-- /.content-wrapper -->
  <!-- Control Sidebar -->
  <aside class="control-sidebar index-gradient">
    <!-- Control sidebar content goes here -->
  </aside>
  <!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->

<!-- jQuery -->
<script src="static/public/jquery/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="static/public/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Ekko Lightbox -->
<script src="static/index/js/ekko-lightbox.min.js"></script>
<!-- AdminLTE App -->
<script src="static/index/js/adminlte.min.js"></script>
<!-- Filterizr-->
<script src="static/public/jquery/jquery.filterizr.min.js"></script>
<!-- AdminLTE for demo purposes -->
<!-- Page specific script -->
<script type="text/javascript" src="static/index/js/identify1.js"></script>
<script src="static/index/js/identify2.js"></script>
</body>
</html>
